<template>
  <div class="house-search-container">
    <!-- 背景装饰元素 -->
    <div class="background-decoration">
      <!-- 精美的动态背景 -->
      <div class="dynamic-background">
        <div class="building building-1"></div>
        <div class="building building-2"></div>
        <div class="building building-3"></div>
        <div class="building building-4"></div>
        <div class="building building-5"></div>
        <div class="cloud cloud-1"></div>
        <div class="cloud cloud-2"></div>
        <div class="cloud cloud-3"></div>
        <div class="sun"></div>
        <div class="light-ray ray-1"></div>
        <div class="light-ray ray-2"></div>
        <div class="light-ray ray-3"></div>
      </div>

      <!-- 浮动装饰元素 -->
      <div class="floating-shape shape-1"></div>
      <div class="floating-shape shape-2"></div>
      <div class="floating-shape shape-3"></div>
      <div class="floating-shape shape-4"></div>
      <div class="floating-shape shape-5"></div>
      <div class="floating-shape shape-6"></div>
    </div>

    <div class="search-wrapper">
      <!-- 顶部导航栏 -->
      <div class="top-navbar">
        <div class="navbar-left">
          <h1 class="app-title">HousingHub</h1>
        </div>
        <div class="navbar-center">
          <el-menu
            :default-active="activeIndex"
            mode="horizontal"
            @select="handleSelect"
            background-color="rgba(255, 255, 255, 0.1)"
            text-color="#fff"
            active-text-color="#4A90E2"
          >
            <el-menu-item index="1" @click="goToHome">首页</el-menu-item>
            <el-menu-item index="2" @click="goToSearch">房源搜索</el-menu-item>
            <el-menu-item index="3" @click="goToPublish">发布房源</el-menu-item>
            <el-menu-item index="4" @click="goToMessages">消息中心</el-menu-item>
          </el-menu>
        </div>
        <div class="navbar-right">
          <el-dropdown @command="handleUserCommand">
            <span class="user-info">
              <el-avatar :size="32" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
              <span class="username">张三</span>
            </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item command="profile">个人资料</el-dropdown-item>
                <el-dropdown-item command="settings">设置</el-dropdown-item>
                <el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
      </div>

      <div class="main-content">
        <!-- 侧边栏 -->
        <div class="sidebar">
          <el-menu
            :default-active="activeMenu"
            class="el-menu-vertical"
            background-color="rgba(0, 0, 0, 0.2)"
            text-color="#fff"
            active-text-color="#4A90E2"
          >
            <el-menu-item index="dashboard" @click="goToHome">
              <el-icon><House /></el-icon>
              <span>首页</span>
            </el-menu-item>
            <el-menu-item index="search" @click="goToSearch">
              <el-icon><Search /></el-icon>
              <span>房源搜索</span>
            </el-menu-item>
            <el-sub-menu index="publish">
              <template #title>
                <el-icon><OfficeBuilding /></el-icon>
                <span>发布房源</span>
              </template>
              <el-menu-item index="publish-house" @click="goToPublishNew">发布新房源</el-menu-item>
              <el-menu-item index="my-houses" @click="goToMyHouses">我的房源</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="agent">
              <template #title>
                <el-icon><User /></el-icon>
                <span>中介申请</span>
              </template>
              <el-menu-item index="agent-apply" @click="goToAgentApply">申请中介</el-menu-item>
              <el-menu-item index="agent-status" @click="goToAgentStatus">申请状态</el-menu-item>
              <el-menu-item index="agent-houses" @click="goToAgentHouses">可代理房源</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="rental">
              <template #title>
                <el-icon><Key /></el-icon>
                <span>租房信息</span>
              </template>
              <el-menu-item index="tenant" @click="goToTenant">租客</el-menu-item>
              <el-menu-item index="landlord" @click="goToLandlord">房东</el-menu-item>
              <el-menu-item index="agent-rental" @click="goToAgentRental">中介</el-menu-item>
            </el-sub-menu>
            <el-menu-item index="messages" @click="goToMessages">
              <el-icon><ChatLineSquare /></el-icon>
              <span>消息中心</span>
            </el-menu-item>
            <el-menu-item index="profile" @click="goToProfile">
              <el-icon><Setting /></el-icon>
              <span>个人资料</span>
            </el-menu-item>
          </el-menu>
        </div>

        <!-- 主内容区域 -->
        <div class="content-area">
          <!-- 搜索区域 -->
          <div class="search-header">
            <h1 class="page-title">房源搜索</h1>
            <div class="search-box">
              <el-input
                  v-model="searchKeyword"
                  placeholder="请输入区域、地铁站或房源名称"
                  size="large"
                  class="search-input"
              >
                <template #prepend>
                  <el-select v-model="searchType" style="width: 120px">
                    <el-option label="区域" value="area"></el-option>
                    <el-option label="地铁站" value="subway"></el-option>
                    <el-option label="房源名称" value="name"></el-option>
                  </el-select>
                </template>
                <template #append>
                  <el-button type="primary" icon="Search" @click="searchHouses">搜索</el-button>
                </template>
              </el-input>
            </div>
          </div>

          <!-- 筛选和结果区域 -->
          <div class="search-content">
            <!-- 筛选面板 -->
            <div class="filter-panel">
              <div class="filter-content">
                <div class="filter-section">
                  <h3>位置</h3>
                  <el-button
                    @click="locateUser"
                    :loading="locating"
                    size="small"
                    type="primary"
                    style="margin-bottom: 10px; width: 100%;"
                  >
                    <el-icon><Location /></el-icon>
                    {{ userLocation ? userLocation.address : '定位当前位置' }}
                  </el-button>
                  <el-cascader
                      v-model="selectedLocation"
                      :options="locationOptions"
                      :props="{ expandTrigger: 'hover' }"
                      placeholder="请选择位置"
                      clearable
                      class="filter-item"
                  />
                </div>

                <div class="filter-section">
                  <h3>价格范围</h3>
                  <el-slider
                      v-model="priceRange"
                      range
                      :min="0"
                      :max="20000"
                      :step="500"
                      show-stops
                      class="filter-item"
                  />
                  <div class="price-display">
                    <span>¥{{ priceRange[0] }}</span>
                    <span>¥{{ priceRange[1] }}</span>
                  </div>
                </div>

                <div class="filter-section">
                  <h3>户型</h3>
                  <el-checkbox-group v-model="selectedLayouts" class="filter-item">
                    <el-checkbox v-for="layout in layouts" :key="layout.value" :label="layout.value">
                      {{ layout.label }}
                    </el-checkbox>
                  </el-checkbox-group>
                </div>

                <div class="filter-section">
                  <h3>出租类型</h3>
                  <el-radio-group v-model="rentType" class="filter-item">
                    <el-radio :label="0">不限</el-radio>
                    <el-radio :label="1">房东直租</el-radio>
                    <el-radio :label="2">中介代理</el-radio>
                  </el-radio-group>
                </div>

                <div class="filter-section">
                  <h3>配套设施</h3>
                  <el-checkbox-group v-model="selectedFacilities" class="filter-item">
                    <el-checkbox v-for="facility in facilities" :key="facility.value" :label="facility.value">
                      {{ facility.label }}
                    </el-checkbox>
                  </el-checkbox-group>
                </div>

<!--
                <div class="filter-section">
                  <h3>更多筛选</h3>
                  <el-checkbox-group v-model="moreFilters" class="filter-item">
                    <el-checkbox v-for="filter in moreFilterOptions" :key="filter.value" :label="filter.value">
                      {{ filter.label }}
                    </el-checkbox>
                  </el-checkbox-group>
                </div>

                <div class="filter-section">
                  <h3>楼层</h3>
                  <el-checkbox-group v-model="floorFilters" class="filter-item">
                    <el-checkbox v-for="floor in floorOptions" :key="floor.value" :label="floor.value">
                      {{ floor.label }}
                    </el-checkbox>
                  </el-checkbox-group>
                </div>

                <div class="filter-section">
                  <h3>装修程度</h3>
                  <el-radio-group v-model="decorationLevel" class="filter-item">
                    <el-radio v-for="level in decorationLevels" :key="level.value" :label="level.value">
                      {{ level.label }}
                    </el-radio>
                  </el-radio-group>
                </div>
-->

                <div class="filter-section">
                  <h3>朝向</h3>
                  <el-checkbox-group v-model="orientationFilters" class="filter-item">
                    <el-checkbox v-for="orientation in orientationOptions" :key="orientation.value" :label="orientation.value">
                      {{ orientation.label }}
                    </el-checkbox>
                  </el-checkbox-group>
                </div>

                <div class="filter-actions">
                  <el-button type="primary" @click="applyFilters">应用筛选</el-button>
                  <el-button @click="resetFilters">重置筛选</el-button>
                </div>
              </div>
            </div>

            <!-- 结果区域 -->
            <div class="results-panel">
              <!-- 排序和视图切换 -->
              <div class="results-header">
                <div class="results-count">
                  找到 <span class="count-number">{{ houseList.length }}</span> 套房源
                </div>
                <div class="results-controls">
                  <el-select v-model="sortBy" placeholder="排序方式" style="width: 150px; margin-right: 15px;">
                    <el-option label="默认排序" value="default"></el-option>
                    <el-option label="价格从低到高" value="priceAsc"></el-option>
                    <el-option label="价格从高到低" value="priceDesc"></el-option>
                    <el-option label="面积从大到小" value="areaDesc"></el-option>
                  </el-select>
                  <el-button-group>
                    <el-button :type="viewMode === 'grid' ? 'primary' : ''" @click="viewMode = 'grid'">
                      <el-icon><Grid /></el-icon>
                    </el-button>
                    <el-button :type="viewMode === 'list' ? 'primary' : ''" @click="viewMode = 'list'">
                      <el-icon><List /></el-icon>
                    </el-button>
                  </el-button-group>
                </div>
              </div>

              <!-- 房源列表 -->
              <div class="house-list" :class="viewMode">
                <!-- 生成更多房源数据用于测试滚动 -->
                <div
                    class="house-item"
                    v-for="house in extendedHouseList"
                    :key="house.id"
                    @click="viewHouseDetail(house.id)"
                >
                  <div class="house-image">
                    <img :src="house.image" :alt="house.title">
                    <div class="house-price">¥{{ house.price }}/月</div>
                  </div>
                  <div class="house-info">
                    <h3 class="house-title">{{ house.title }}</h3>
                    <p class="house-location">
                      <el-icon><Location /></el-icon>
                      {{ house.location }}
                    </p>
                    <div class="house-meta">
                      <span>{{ house.layout }}</span>
                      <span>{{ house.area }}㎡</span>
                      <span>{{ house.orientation }}</span>
                    </div>
                    <div class="house-tags">
                      <el-tag v-for="tag in house.tags" :key="tag" size="small" type="info">{{ tag }}</el-tag>
                    </div>
                  </div>
                </div>
              </div>

              <!-- 分页 -->
              <div class="pagination-container">
                <el-pagination
                    v-model:current-page="currentPage"
                    v-model:page-size="pageSize"
                    :page-sizes="[10, 20, 30, 50]"
                    :total="totalHouses"
                    layout="total, sizes, prev, pager, next, jumper"
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import {
  House,
  Search,
  OfficeBuilding,
  User,
  Key,
  ChatLineSquare,
  Setting,
  Location,
  Grid,
  List
} from '@element-plus/icons-vue'

const router = useRouter()
const activeMenu = ref('search')
const activeIndex = ref('2')
const locating = ref(false)
const userLocation = ref(null)

// 搜索相关数据
const searchKeyword = ref('')
const searchType = ref('area')

// 筛选相关数据
const selectedLocation = ref([])
const priceRange = ref([0, 10000])
const selectedLayouts = ref([])
const rentType = ref(0)
const selectedFacilities = ref([])
const moreFilters = ref([])
const floorFilters = ref([])
const decorationLevel = ref('')
const orientationFilters = ref([])

// 排序和视图
const sortBy = ref('default')
const viewMode = ref('grid')
const currentPage = ref(1)
const pageSize = ref(10)
const totalHouses = ref(128)

// 位置选项
const locationOptions = ref([
  {
    value: 'beijing',
    label: '北京市',
    children: [
      {
        value: 'chaoyang',
        label: '朝阳区',
        children: [
          { value: 'cbd', label: 'CBD' },
          { value: 'sanlitun', label: '三里屯' }
        ]
      },
      {
        value: 'haidian',
        label: '海淀区',
        children: [
          { value: 'zhongguancun', label: '中关村' },
          { value: 'wudaokou', label: '五道口' }
        ]
      }
    ]
  },
  {
    value: 'shanghai',
    label: '上海市',
    children: [
      {
        value: 'pudong',
        label: '浦东新区',
        children: [
          { value: 'lujiazui', label: '陆家嘴' },
          { value: 'zhangjiang', label: '张江' }
        ]
      }
    ]
  }
])

// 户型选项
const layouts = ref([
  { value: 1, label: '一居室' },
  { value: 2, label: '两居室' },
  { value: 3, label: '三居室' },
  { value: 4, label: '四居室及以上' }
])

// 配套设施选项
const facilities = ref([
  { value: 'wifi', label: 'WiFi' },
  { value: 'ac', label: '空调' },
  { value: 'washer', label: '洗衣机' },
  { value: 'refrigerator', label: '冰箱' },
  { value: 'elevator', label: '电梯' },
  { value: 'parking', label: '停车位' }
])

// 更多筛选选项
const moreFilterOptions = ref([
  { value: 'nearSubway', label: '近地铁' },
  { value: 'new', label: '新上架' },
  { value: 'verified', label: '实勘房源' },
  { value: 'shortLease', label: '短租' }
])

// 楼层选项
const floorOptions = ref([
  { value: 'low', label: '低楼层' },
  { value: 'middle', label: '中楼层' },
  { value: 'high', label: '高楼层' }
])

// 装修程度选项
const decorationLevels = ref([
  { value: 'simple', label: '简装' },
  { value: 'fine', label: '精装修' },
  { value: 'luxury', label: '豪华装修' }
])

// 朝向选项
const orientationOptions = ref([
  { value: 'east', label: '朝东' },
  { value: 'south', label: '朝南' },
  { value: 'west', label: '朝西' },
  { value: 'north', label: '朝北' }
])

// 房源列表数据
const houseList = ref([
  {
    id: 1,
    title: '精致一居室公寓',
    location: '北京市朝阳区CBD',
    price: 4500,
    layout: '一居室',
    area: 60,
    orientation: '南北',
    image: 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1769&q=80',
    tags: ['近地铁', '精装修', '拎包入住']

  },
  {
    id: 2,
    title: '豪华两居室',
    location: '上海市浦东新区',
    price: 8500,
    layout: '两居室',
    area: 90,
    orientation: '南北',
    image: 'https://images.unsplash.com/photo-1600585154340-be6161a56a0c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80',
    tags: ['学区房', '地铁房', '新上架']
  },
  {
    id: 5,
    title: '精品复式公寓',
    address: '杭州市西湖区文三路202号',
    price: 7200,
    layout: '两居室',
    area: 85,
    orientation: '南北',
    image: 'https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1753&q=80',
    tags: ['复式', '江景房', '近商圈'],
    favorited: true
  },
  {
    id: 3,
    title: '舒适三居室别墅',
    location: '广州市天河区',
    price: 15000,
    layout: '三居室',
    area: 150,
    orientation: '南北',
    image: 'https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80',
    tags: ['别墅', '带花园', '独栋']
  },
  {
    id: 4,
    title: '现代化loft公寓',
    location: '深圳市南山区',
    price: 6500,
    layout: '一居室',
    area: 75,
    orientation: '东西',
    image: 'https://images.unsplash.com/photo-1575517114892-6a0eb8c4fd5d?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80',
    tags: ['loft', '创意空间']
  },
  {
    id: 5,
    title: '精品复式公寓',
    location: '杭州市西湖区',
    price: 7200,
    layout: '两居室',
    area: 85,
    orientation: '南北',
    image: 'https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1753&q=80',
    tags: ['复式', '江景房', '近商圈']
  },
  {
    id: 6,
    title: '温馨单间出租',
    location: '成都市锦江区',
    price: 2800,
    layout: '单间',
    area: 35,
    orientation: '南',
    image: 'https://images.unsplash.com/photo-1584622650111-993a426fbf0a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80',
    tags: ['单间', '经济实惠', '学生首选']
  }
])

// 扩展房源列表用于测试滚动
const extendedHouseList = computed(() => {
  const extended = []
  for (let i = 0; i < 30; i++) {
    const houseIndex = i % houseList.value.length
    extended.push({
      ...houseList.value[houseIndex],
      id: houseList.value[houseIndex].id + i * 10,
      title: `${houseList.value[houseIndex].title} - ${i + 1}`,
      price: houseList.value[houseIndex].price + Math.floor(Math.random() * 1000)
    })
  }
  return extended
})

// 定位用户位置
const locateUser = () => {
  locating.value = true

  // 模拟定位过程
  setTimeout(() => {
    locating.value = false
    userLocation.value = {
      longitude: 116.404,
      latitude: 39.915,
      address: '北京市朝阳区'
    }

    ElMessage.success('定位成功')
  }, 1500)
}

// 顶部导航栏跳转
const goToHome = () => {
  router.push('/')
}

const goToSearch = () => {
  router.push('/house/search')
}

const goToPublish = () => {
  router.push('/house/publish')
}

const goToMessages = () => {
  router.push('/message')
}

// 用户命令处理
const handleUserCommand = (command) => {
  switch (command) {
    case 'profile':
      router.push('/profile')
      break
    case 'settings':
      router.push('/settings')
      break
    case 'logout':
      ElMessage.success('退出登录成功')
      localStorage.removeItem('userEmail')
      localStorage.removeItem('isLoggedIn')
      router.push('/login')
      break
  }
}

// 侧边栏跳转
const goToPublishNew = () => {
  router.push('/house/publish')
}

const goToMyHouses = () => {
  router.push('/house/my-houses')
}

const goToAgentApply = () => {
  router.push('/agent/apply')
}

const goToAgentStatus = () => {
  router.push('/agent/status')
}

const goToAgentHouses = () => {
  router.push('/agent/houses')
}

const goToTenant = () => {
  router.push('/rental/tenant')
}

const goToLandlord = () => {
  router.push('/rental/landlord')
}

const goToAgentRental = () => {
  router.push('/rental/agent')
}

const goToProfile = () => {
  router.push('/profile')
}

// 菜单选择处理
const handleSelect = (key) => {
  switch (key) {
    case '1':
      router.push('/')
      break
    case '2':
      router.push('/house/search')
      break
    case '3':
      router.push('/house/publish')
      break
    case '4':
      router.push('/message')
      break
  }
}

// 搜索房源
const searchHouses = () => {
  ElMessage.info(`搜索关键词: ${searchKeyword.value}`)
}

// 应用筛选
const applyFilters = () => {
  ElMessage.success('筛选条件已应用')

  // 如果有用户位置信息，将其传递给后端
  if (userLocation.value) {
    console.log('用户位置信息:', userLocation.value)
    // 这里应该将位置信息发送到后端
  }
}

// 重置筛选
const resetFilters = () => {
  selectedLocation.value = []
  priceRange.value = [0, 10000]
  selectedLayouts.value = []
  rentType.value = 0
  selectedFacilities.value = []
  moreFilters.value = []
  floorFilters.value = []
  decorationLevel.value = ''
  orientationFilters.value = []
  userLocation.value = null
  ElMessage.info('筛选条件已重置')
}

// 查看房源详情
const viewHouseDetail = (id) => {
  router.push(`/house/detail/${id}`)
}

// 分页相关方法
const handleSizeChange = (val) => {
  pageSize.value = val
  ElMessage.info(`每页显示 ${val} 条`)
}

const handleCurrentChange = (val) => {
  currentPage.value = val
  ElMessage.info(`当前页: ${val}`)
}
</script>

<style scoped>
.house-search-container {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

.background-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

/* 精美的动态背景 */
.dynamic-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, #1a2980, #26d0ce);
  overflow: hidden;
}

/* 建筑物 */
.building {
  position: absolute;
  bottom: 0;
  background: rgba(30, 30, 50, 0.8);
  border-radius: 5px 5px 0 0;
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.building-1 {
  left: 10%;
  width: 80px;
  height: 300px;
  animation: buildingGlow 4s infinite alternate;
}

.building-2 {
  left: 25%;
  width: 120px;
  height: 400px;
  animation: buildingGlow 5s infinite alternate-reverse;
}

.building-3 {
  left: 45%;
  width: 100px;
  height: 350px;
  animation: buildingGlow 6s infinite alternate;
}

.building-4 {
  left: 65%;
  width: 140px;
  height: 450px;
  animation: buildingGlow 4.5s infinite alternate-reverse;
}

.building-5 {
  left: 80%;
  width: 90px;
  height: 320px;
  animation: buildingGlow 5.5s infinite alternate;
}

@keyframes buildingGlow {
  0% {
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
  }
  100% {
    box-shadow: 0 -5px 25px rgba(100, 200, 255, 0.6);
  }
}

/* 云朵 */
.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  filter: blur(2px);
}

.cloud-1 {
  top: 20%;
  left: 5%;
  width: 80px;
  height: 30px;
  animation: cloudMove 25s linear infinite;
}

.cloud-2 {
  top: 35%;
  left: 70%;
  width: 120px;
  height: 40px;
  animation: cloudMove 30s linear infinite;
}

.cloud-3 {
  top: 15%;
  left: 40%;
  width: 100px;
  height: 35px;
  animation: cloudMove 35s linear infinite;
}

@keyframes cloudMove {
  0% {
    transform: translateX(-100px);
  }
  100% {
    transform: translateX(calc(100vw + 100px));
  }
}

/* 太阳 */
.sun {
  position: absolute;
  top: 80px;
  right: 100px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #ffeb3b, #ffc107);
  border-radius: 50%;
  box-shadow: 0 0 40px #ff9800, 0 0 80px #ff5722;
  animation: sunPulse 3s infinite alternate;
}

@keyframes sunPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 40px #ff9800, 0 0 80px #ff5722;
  }
  100% {
    transform: scale(1.1);
    box-shadow: 0 0 60px #ff9800, 0 0 100px #ff5722;
  }
}

/* 光线 */
.light-ray {
  position: absolute;
  top: 120px;
  right: 140px;
  width: 400px;
  height: 200px;
  background: linear-gradient(to right, transparent, rgba(255, 235, 59, 0.2), transparent);
  transform-origin: left center;
  animation: rayRotate 10s infinite linear;
}

.ray-1 {
  transform: rotate(0deg);
  animation-delay: 0s;
}

.ray-2 {
  transform: rotate(60deg);
  animation-delay: 2s;
}

.ray-3 {
  transform: rotate(120deg);
  animation-delay: 4s;
}

@keyframes rayRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 浮动装饰元素 */
.floating-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  animation: float 15s infinite linear;
}

.shape-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -100px;
  animation-duration: 20s;
  background: radial-gradient(circle, rgba(74, 144, 226, 0.2) 0%, transparent 70%);
}

.shape-2 {
  width: 200px;
  height: 200px;
  bottom: -80px;
  right: -80px;
  animation-duration: 25s;
  animation-direction: reverse;
  background: radial-gradient(circle, rgba(255, 107, 107, 0.2) 0%, transparent 70%);
}

.shape-3 {
  width: 150px;
  height: 150px;
  top: 30%;
  right: 20%;
  animation-duration: 15s;
  background: radial-gradient(circle, rgba(80, 227, 194, 0.2) 0%, transparent 70%);
}

.shape-4 {
  width: 100px;
  height: 100px;
  bottom: 20%;
  left: 20%;
  animation-duration: 18s;
  animation-direction: reverse;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.2) 0%, transparent 70%);
}

.shape-5 {
  width: 250px;
  height: 250px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 22s;
  background: radial-gradient(circle, rgba(155, 89, 182, 0.2) 0%, transparent 70%);
}

.shape-6 {
  width: 180px;
  height: 180px;
  top: 70%;
  left: 10%;
  animation-duration: 28s;
  background: radial-gradient(circle, rgba(231, 76, 60, 0.2) 0%, transparent 70%);
}

@keyframes float {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(20px, 20px) rotate(90deg);
  }
  50% {
    transform: translate(0, 40px) rotate(180deg);
  }
  75% {
    transform: translate(-20px, 20px) rotate(270deg);
  }
  100% {
    transform: translate(0, 0) rotate(360deg);
  }
}

.search-wrapper {
  width: 100%;
  height: 100vh;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-title {
  color: white;
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.navbar-center {
  flex: 1;
  margin: 0 20px;
}

:deep(.el-menu--horizontal) {
  border: none;
  background: transparent !important;
}

:deep(.el-menu--horizontal .el-menu-item) {
  color: white;
  border: none;
}

:deep(.el-menu--horizontal .el-menu-item:hover) {
  background: rgba(255, 255, 255, 0.2) !important;
}

:deep(.el-menu--horizontal .el-menu-item.is-active) {
  color: #4A90E2 !important;
  border: none;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: white;
}

.username {
  font-size: 16px;
  font-weight: 500;
}

.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 250px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  padding: 20px 0;
  height: 100%;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}

.sidebar::-webkit-scrollbar {
  width: 0px;
  background: transparent; /* Chrome/Safari/Webkit */
}

.el-menu-vertical {
  border: none !important;
  height: 100%;
}

.el-menu-item,
.el-sub-menu__title {
  margin: 5px 10px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.el-menu-item:hover,
.el-sub-menu__title:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  padding: 20px;
}

.search-header {
  text-align: center;
  margin-bottom: 30px;
}

.page-title {
  color: #2c3e50;
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 30px;
}

.search-box {
  max-width: 800px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
}

.search-content {
  display: flex;
  gap: 30px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  flex: 1;
  overflow: hidden;
}

.filter-panel {
  width: 250px;
  flex-shrink: 100;
  background: #f8f9fa;
  border-radius: 10px;
  height: 10%;
  display: flex;
  flex-direction: column;
}

.filter-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #c1c1c1 transparent;
}

.filter-content::-webkit-scrollbar {
  width: 6px;
}

.filter-content::-webkit-scrollbar-track {
  background: transparent;
}

.filter-content::-webkit-scrollbar-thumb {
  background-color: #c1c1c1;
  border-radius: 3px;
}

.filter-section {
  margin-bottom: 25px;
}

.filter-section h3 {
  margin: 0 0 15px;
  font-size: 18px;
  color: #2c3e50;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.filter-item {
  width: 100%;
}

.price-display {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 14px;
  color: #7f8c8d;
}

.filter-actions {
  display: flex;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
  position: sticky;
  bottom: 0;
  background: #f8f9fa;
  padding: 20px;
  margin: 0 -20px 0 -20px;
}

.results-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.results-count {
  font-size: 16px;
  color: #7f8c8d;
}

.count-number {
  font-weight: 700;
  color: #409EFF;
}

.house-list.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
  overflow-y: auto;
  flex: 1;
  padding-right: 10px;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #c1c1c1 transparent;
}

.house-list.grid::-webkit-scrollbar {
  width: 6px;
}

.house-list.grid::-webkit-scrollbar-track {
  background: transparent;
}

.house-list.grid::-webkit-scrollbar-thumb {
  background-color: #c1c1c1;
  border-radius: 3px;
}

.house-list.list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
  overflow-y: auto;
  flex: 1;
  padding-right: 10px;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #c1c1c1 transparent;
}

.house-list.list::-webkit-scrollbar {
  width: 6px;
}

.house-list.list::-webkit-scrollbar-track {
  background: transparent;
}

.house-list.list::-webkit-scrollbar-thumb {
  background-color: #c1c1c1;
  border-radius: 3px;
}

.house-item {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
}

.house-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.house-list.grid .house-item {
  display: flex;
  flex-direction: column;
}

.house-list.list .house-item {
  display: flex;
  flex-direction: row;
}

.house-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.house-list.list .house-image {
  width: 300px;
  flex-shrink: 0;
}

.house-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.house-item:hover .house-image img {
  transform: scale(1.05);
}

.house-price {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(74, 144, 226, 0.9);
  color: white;
  padding: 5px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
}

.house-info {
  padding: 20px;
  flex: 1;
}

.house-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
}

.house-location {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 15px;
  font-size: 14px;
  color: #7f8c8d;
}

.house-meta {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  font-size: 13px;
  color: #7f8c8d;
}

.house-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-container {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

@media (max-width: 1200px) {
  .search-content {
    flex-direction: column;
  }

  .filter-panel {
    width: 100%;
    height: 300px;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .results-controls {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
}

@media (max-width: 992px) {
  .sidebar {
    width: 80px;
  }

  .app-title,
  .el-menu-item span,
  .el-sub-menu__title span {
    display: none;
  }

  .house-list.list .house-item {
    flex-direction: column;
  }

  .house-list.list .house-image {
    width: 100%;
    height: 200px;
  }

  .results-controls {
    flex-direction: column;
    gap: 10px;
  }

  .filter-actions {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .search-wrapper {
    margin: 10px;
    padding: 10px;
  }

  .search-content {
    padding: 15px;
  }

  .house-list.grid {
    grid-template-columns: 1fr;
  }
}
</style>
